package com.wsc.personalblog.mapper;

import com.wsc.personalblog.entity.Article;
import com.wsc.personalblog.entity.ArticleExample;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
@Mapper
public interface ArticleMapper {

    List<Article> getArticleByCIdKey(
            @Param("categoryId") Integer categoryId ,
            @Param("keyword") String keyword ,
            @Param("articleIdList") List<Integer> articleIdList);

    int countByExample(ArticleExample example);

    int deleteByExample(ArticleExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Article record);

    int insertSelective(Article record);

    List<Article> selectByExampleWithBLOBs(ArticleExample example);

    List<Article> selectByExample(ArticleExample example);

    Article selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Article record, @Param("example") ArticleExample example);

    int updateByExampleWithBLOBs(@Param("record") Article record, @Param("example") ArticleExample example);

    int updateByExample(@Param("record") Article record, @Param("example") ArticleExample example);

    int updateByPrimaryKeySelective(Article record);

    int updateByPrimaryKeyWithBLOBs(Article record);

    int updateByPrimaryKey(Article record);

    Integer getLastArticleId();
    @Select("select id from t_article")
    List<Integer> getArticleIdAll();

    void removeCommentByArticleId(@Param("articleId") Integer articleId);

    Integer getDraftsCount();

    List<Article> getArticleInfoByCIdKey(@Param("categoryId") Integer categoryId ,
                                         @Param("keyword") String keyword ,
                                         @Param("articleIdList") List<Integer> articleIdList);

    List<Article> getDraftsInfo(Integer categoryId, String keyword, List<Integer> articleIdList);
}